#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: liang kang
@contact: gangkanli1219@gmail.com
@time: 2018/5/24 12:06
@desc: 
"""
import itk


def read_dicom(dcm):
    dicom_reader = itk.ImageSeriesReader[itk.Image.SS3].New()
    dicom_reader.GlobalWarningDisplayOff()
    names = itk.GDCMSeriesFileNames.New()
    names.SetInputDirectory(dcm)
    names.Update()
    dicom_reader.SetFileNames(names.GetInputFileNames())
    dcm_io = itk.GDCMImageIO.New()
    dicom_reader.SetImageIO(dcm_io)
    dicom_reader.Update()
    image = dicom_reader.GetOutput()
    return image, dcm_io
